package com.flot.yazb.model.user;

import com.flot.yazb.base.model.BModel;
import com.flot.yazb.base.client.RetrofitFactory;
import com.flot.yazb.aop.stub.RMCallback;
import com.flot.yazb.aop.stub.RMResponse;
import com.flot.yazb.retrofit.service.BService;

import java.util.Map;

public class DubaiModel extends BModel {
    public String id;
    public String beizhu;


    public static void getDubai(String id,final Transit<DubaiModel> incubator) {
        RetrofitFactory.getInstance()
                .create(BService.UserService.class)
                .getDubai(id)
                .enqueue(new RMCallback<RMResponse<DubaiModel>>(incubator.getContext()) {
                    @Override
                    protected void onSuccess(RMResponse<DubaiModel> result) {
                        incubator.onBorn(result.content, result.code(), result.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {
                        incubator.onBorn(null, errorCode, errorInfo);
                    }
                });
    }

    public static void setDubai(Map map, final Transit<DubaiModel> incubator) {
        RetrofitFactory.getInstance()
                .create(BService.UserService.class)
                .setDubai(map)
                .enqueue(new RMCallback<RMResponse<DubaiModel>>(incubator.getContext()) {
                    @Override
                    protected void onSuccess(RMResponse<DubaiModel> result) {
                        incubator.onBorn(result.content, result.code(), result.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {
                        incubator.onBorn(null, errorCode, errorInfo);
                    }
                });
    }
}
